class RelatioShip:

    def __init__(self):
        self.couple = []

    def make_couple(self, obj1, obj2):
        self.couple = [obj1, obj2] # 两个人就成了对象
        print("[%s] 和 [%s] 确定了男女关系..." % (obj1.name, obj2.name))

    def break_couple(self, obj1, obj2):
        self.couple = []
        print("[%s] 和 [%s] 分手了..." % (obj1.name, obj2.name))

    def get_my_partner(self, obj): # p1,p2
        print('找[%s]的对象:' % obj.name)
        if obj in self.couple:
            print(self.couple[self.couple.index(obj)-1].name)
        else:
            print('单身狗')


class Person:
    def __init__(self, name, age, sex, relation):
        self.name = name
        self.age = age
        self.sex = sex
        self.relation = relation # 在每个人的实力里存储关系对象


relation_obj = RelatioShip()
p1 = Person('汪小菲', 41, 'M', relation_obj)
p2 = Person('徐熙媛', 40, 'F', relation_obj)
p3 = Person('马晓梅', 29, 'F', relation_obj)

relation_obj.make_couple(p1, p2)
p1.relation.get_my_partner(p1)
relation_obj.break_couple(p1,p2)
p1.relation.get_my_partner(p1)
relation_obj.make_couple(p1,p3)
p1.relation.get_my_partner(p1)